package cn.zhage.aimin.canal1.test;

import cn.zhage.aimin.base.model.DrugIndex;
import cn.zhage.aimin.canal.client.annotation.CanalTableMapping;
import cn.zhage.aimin.canal.client.handler.EntityHandler;
import cn.zhage.aimin.canal1.es.mapper.DrugIndexMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/*
 *
 * @author 渣哥
 */
@Component
@CanalTableMapping("t_drug")
@RequiredArgsConstructor
public class DrugHandler implements EntityHandler<DrugIndex> {

    private final DrugIndexMapper drugIndexMapper;

    @Override
    public void insert(DrugIndex drugIndex) {
        System.out.println(drugIndex.toString());
    }

    @Override
    public void update(DrugIndex before, DrugIndex after) {
        drugIndexMapper.updateById(after);
    }

    @Override
    public void delete(DrugIndex drugIndex) {
        System.out.println(drugIndex.toString());
    }
}

